# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: 
pkgname=ocaml-bisect_ppx
_pkgname=bisect_ppx
pkgver=2.8.1
pkgrel=1
pkgdesc="Code coverage for OCaml"
url="https://github.com/aantron/bisect_ppx"
arch="all !riscv64"  # limited by ocaml aport
license="MIT"
depends="ocaml-runtime ocaml-cmdliner ocaml-ppxlib"
depends_dev="
	$pkgname=$pkgver-r$pkgrel
	ocaml-cmdliner-dev
	ocaml-ppxlib-dev
	"
makedepends="$depends_dev dune ocaml"
options="!check"    # needs ocamlformat
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/aantron/bisect_ppx/archive/$pkgver.tar.gz
	ppxlib-0.26-compat.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"
_ocamldir=usr/lib/ocaml

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	dune build --release --verbose
}

check() {
	dune runtest --verbose
}

package() {
	dune install \
		--destdir="$pkgdir" \
		--docdir=/.omit
	rm -Rf "$pkgdir"/.omit
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find $_ocamldir \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
6becffb012bcd02cf8042e3f21cc0f1b6ae18984077951c8213f31ae931b0ba69d4b04ae0b1976d59919fd378e5197b49310a6c80ef3a6e06fb48275ed79c149  ocaml-bisect_ppx-2.8.1.tar.gz
c870b0a6b82d23e7e5595ba80582923a5fefb7720d24c2cc505e0b9effe77f8b1713589f699c2e037fa28118ec6245d4f403c1aebd563785d41ee17bae251eb6  ppxlib-0.26-compat.patch
"
